package slash.entities;

import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.geom.*;

import slash.MainGame;
import slash.collision.CollisionMask;

public class CollisionBox extends AbstractEntity{
	
	protected float posX,posY,width,height;

	/**
	 * Creates a Collision Box with
	 * coordinates and mask shape
	 * @param posX
	 * @param posY
	 * @param shape
	 */
	public CollisionBox(float posX, float posY, Shape shape) {
		super(posX, posY, shape);
		this.setCollisionMask(new CollisionMask(shape,this));
		this.setCollidable(true);
		this.setStationary(true);
	}
	
	/**
	 * Creates a Rectangle shape
	 * collision box
	 * @param x coordinates
	 * @param y coordinates
	 * @param horizontalLength
	 * @param verticalLength
	 */
	public CollisionBox(float x, float y, float w, float h){
		super(x,y);
		Rectangle rect = new Rectangle(this.getCenterX(), this.getCenterY(), 0, 0);
		//rect.grow(h, w);
		Polygon poly = new Polygon();
		poly.addPoint(x, y);
		poly.addPoint(x*h, y);
		poly.addPoint(x, y*w);
		poly.addPoint(x*h, y*w);
		this.setCollisionMask(new CollisionMask(poly,this));
		this.setCollidable(true);
		this.setStationary(true);
	}
	
	public void createBoxShape(){
		
	}

	@Override
	public void render(Graphics g) {
		super.render(g);
	}

	@Override
	public void update(GameContainer container, int time) {
		super.update(container, time);
	}

}
